package net.wofly.sale.order.service.impl;

import net.wofly.sale.order.domain.OrderActivity;
import net.wofly.sale.order.repository.OrderActivityRepository;
import net.wofly.sale.order.service.IOrderActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service("iOrderActivityService")
@Transactional
public class OrderActivityServiceImpl implements IOrderActivityService {
    
    @Autowired
    OrderActivityRepository orderActivityRepository;
    
    @Override
    public OrderActivity save(OrderActivity entity) {
        return orderActivityRepository.save(entity);
    }
    
    @Override
    public void delete(OrderActivity entity) {
        orderActivityRepository.delete(entity);
    }
    
    @Override
    public void delete(String key) {
        orderActivityRepository.delete(key);
    }
    
    @Override
    public OrderActivity findOne(String key) {
        return orderActivityRepository.findOne(key);
    }
    
    @Override
    public List<OrderActivity> save(List<OrderActivity> entityList) {
        return (List<OrderActivity>) orderActivityRepository.save(entityList);
    }
    
    @Override
    public List<OrderActivity> findByOrderID(String orderID) {
        return orderActivityRepository.findByOrderID(orderID);
    }
    
    @Override
    public List<OrderActivity> findByOrderIDAndRelateType(String orderID, Integer relateType) {
        return orderActivityRepository.findByOrderIDAndRelateType(orderID, relateType);
    }
}
